<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="net.doglog.*" %>
<%@ page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Post List</title>
<link rel="stylesheet" type="text/css" href="/admin/style.css" />
</head>
<body>

<ul>
	<li><a href="/">Homepage</a></li>
	<li><a href="/admin">Dashboard</a></li>
	<li><a href="/admin/post/new">New Post</a></li>
</ul>
<h3>Post List</h3>

<%
List<Post> posts = PostUtil.getAllPosts();
if (posts.size() > 0) {
%>
	<table border="1" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>Id</th>
			<th>Time</th>
			<th>Title</th>
			<th>Tags</th>
		</tr>
	</thead>
	<tbody>
	<% for (Post post : posts) { %>
		<tr>
			<td><a href="/post/<%= post.getId() %>"><%= post.getId() %></a></td>
			<td><%= PostUtil.formatTime(post.getTime()) %></td>
			<td><a href="/admin/post/edit/<%= post.getId() %>"><%= post.getTitle() %></a></td>
			<td><%= PostUtil.formatTagsPlain(post.getTags()) %></td>
		</tr>
	<% } %>
	</tbody>
	</table>
<%
} else {
	BlogUtil.printError(out, Blog.errorNoPostFound);
}
%>

</body>
</html>